package zy.data.food.converter;

import org.springframework.beans.BeanUtils;
import zy.data.food.domain.OrderMaster;
import zy.data.food.dto.OrderDTO;

import java.util.List;
import java.util.stream.Collectors;

public class OrderMaster2OrderDTOConverter {

    public static OrderDTO convert(OrderMaster orderMaster){
        //将ordermaster对象转换为orderdto
        OrderDTO orderDTO = new OrderDTO();
        BeanUtils.copyProperties(orderMaster,orderDTO);
        return orderDTO;
    }

    public static List<OrderDTO> convert(List<OrderMaster> orderMasterList){

        return orderMasterList.stream().map(e -> convert(e)).collect(Collectors.toList());

    }

}
